+Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkrange.c:
+ (second_timeout):
+ (initial_timeout):
+ (update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
+ (gtk_range_calc_layout): compute the new layout based on an
+ adjustment->value being passed in as argument.
+ (gtk_range_button_press): for button2 slider warps, first recalc
+ the layout, then adjust the value. also, use update_slider_position()
+ for adjusting the value, so we keep pixel quantisation at which we
+ usually operate (upon motion or button releases). the reason for this
+ is that, we can't change the adjustment upon button2 presses to a non
+ quantised value and upon button2 release re-quantise the value since
+ that'd alter the value even if we didn't get any motion events (causing
+ unexpected scroll area warps upon release and/or slider pixel-jitter).
+ (gtk_range_motion_notify): update the slider position from queried
+ coordinates, not event coordinates.
+
+Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
+ the default gc values are: width=0, CapBut, JoinMiter.
+
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
+Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkrange.c:
+ (second_timeout):
+ (initial_timeout):
+ (update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
+ (gtk_range_calc_layout): compute the new layout based on an
+ adjustment->value being passed in as argument.
+ (gtk_range_button_press): for button2 slider warps, first recalc
+ the layout, then adjust the value. also, use update_slider_position()
+ for adjusting the value, so we keep pixel quantisation at which we
+ usually operate (upon motion or button releases). the reason for this
+ is that, we can't change the adjustment upon button2 presses to a non
+ quantised value and upon button2 release re-quantise the value since
+ that'd alter the value even if we didn't get any motion events (causing
+ unexpected scroll area warps upon release and/or slider pixel-jitter).
+ (gtk_range_motion_notify): update the slider position from queried
+ coordinates, not event coordinates.
+
+Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
+ the default gc values are: width=0, CapBut, JoinMiter.
+
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
+Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkrange.c:
+ (second_timeout):
+ (initial_timeout):
+ (update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
+ (gtk_range_calc_layout): compute the new layout based on an
+ adjustment->value being passed in as argument.
+ (gtk_range_button_press): for button2 slider warps, first recalc
+ the layout, then adjust the value. also, use update_slider_position()
+ for adjusting the value, so we keep pixel quantisation at which we
+ usually operate (upon motion or button releases). the reason for this
+ is that, we can't change the adjustment upon button2 presses to a non
+ quantised value and upon button2 release re-quantise the value since
+ that'd alter the value even if we didn't get any motion events (causing
+ unexpected scroll area warps upon release and/or slider pixel-jitter).
+ (gtk_range_motion_notify): update the slider position from queried
+ coordinates, not event coordinates.
+
+Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
+ the default gc values are: width=0, CapBut, JoinMiter.
+
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
+Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkrange.c:
+ (second_timeout):
+ (initial_timeout):
+ (update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
+ (gtk_range_calc_layout): compute the new layout based on an
+ adjustment->value being passed in as argument.
+ (gtk_range_button_press): for button2 slider warps, first recalc
+ the layout, then adjust the value. also, use update_slider_position()
+ for adjusting the value, so we keep pixel quantisation at which we
+ usually operate (upon motion or button releases). the reason for this
+ is that, we can't change the adjustment upon button2 presses to a non
+ quantised value and upon button2 release re-quantise the value since
+ that'd alter the value even if we didn't get any motion events (causing
+ unexpected scroll area warps upon release and/or slider pixel-jitter).
+ (gtk_range_motion_notify): update the slider position from queried
+ coordinates, not event coordinates.
+
+Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
+ the default gc values are: width=0, CapBut, JoinMiter.
+
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
+Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkrange.c:
+ (second_timeout):
+ (initial_timeout):
+ (update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
+ (gtk_range_calc_layout): compute the new layout based on an
+ adjustment->value being passed in as argument.
+ (gtk_range_button_press): for button2 slider warps, first recalc
+ the layout, then adjust the value. also, use update_slider_position()
+ for adjusting the value, so we keep pixel quantisation at which we
+ usually operate (upon motion or button releases). the reason for this
+ is that, we can't change the adjustment upon button2 presses to a non
+ quantised value and upon button2 release re-quantise the value since
+ that'd alter the value even if we didn't get any motion events (causing
+ unexpected scroll area warps upon release and/or slider pixel-jitter).
+ (gtk_range_motion_notify): update the slider position from queried
+ coordinates, not event coordinates.
+
+Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
+ the default gc values are: width=0, CapBut, JoinMiter.
+
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
+Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkrange.c:
+ (second_timeout):
+ (initial_timeout):
+ (update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
+ (gtk_range_calc_layout): compute the new layout based on an
+ adjustment->value being passed in as argument.
+ (gtk_range_button_press): for button2 slider warps, first recalc
+ the layout, then adjust the value. also, use update_slider_position()
+ for adjusting the value, so we keep pixel quantisation at which we
+ usually operate (upon motion or button releases). the reason for this
+ is that, we can't change the adjustment upon button2 presses to a non
+ quantised value and upon button2 release re-quantise the value since
+ that'd alter the value even if we didn't get any motion events (causing
+ unexpected scroll area warps upon release and/or slider pixel-jitter).
+ (gtk_range_motion_notify): update the slider position from queried
+ coordinates, not event coordinates.
+
+Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
+ the default gc values are: width=0, CapBut, JoinMiter.
+
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
+Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkrange.c:
+ (second_timeout):
+ (initial_timeout):
+ (update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
+ (gtk_range_calc_layout): compute the new layout based on an
+ adjustment->value being passed in as argument.
+ (gtk_range_button_press): for button2 slider warps, first recalc
+ the layout, then adjust the value. also, use update_slider_position()
+ for adjusting the value, so we keep pixel quantisation at which we
+ usually operate (upon motion or button releases). the reason for this
+ is that, we can't change the adjustment upon button2 presses to a non
+ quantised value and upon button2 release re-quantise the value since
+ that'd alter the value even if we didn't get any motion events (causing
+ unexpected scroll area warps upon release and/or slider pixel-jitter).
+ (gtk_range_motion_notify): update the slider position from queried
+ coordinates, not event coordinates.
+
+Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
+ the default gc values are: width=0, CapBut, JoinMiter.
+
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
#GtkRcStyle structures to form a #GtkStyle.
</para>
+@parent_instance:
@name:
@bg_pixmap_name:
@font_desc:
gint grab_button; /* 0 if none */
};
+
static void gtk_range_class_init (GtkRangeClass *klass);
static void gtk_range_init (GtkRange *range);
static void gtk_range_set_property (GObject *object,
GdkEventScroll *event);
static void gtk_range_style_set (GtkWidget *widget,
GtkStyle *previous_style);
+static void update_slider_position (GtkRange *range,
+ gint mouse_x,
+ gint mouse_y);
/* Range methods */
static void gtk_range_scroll (GtkRange *range,
GtkScrollType scroll);
static gboolean gtk_range_update_mouse_location (GtkRange *range);
-static void gtk_range_calc_layout (GtkRange *range);
+static void gtk_range_calc_layout (GtkRange *range,
+ gdouble adjustment_value);
static void gtk_range_get_props (GtkRange *range,
gint *slider_width,
gint *stepper_size,
range = GTK_RANGE (widget);
range->need_recalc = TRUE;
- gtk_range_calc_layout (range);
+ gtk_range_calc_layout (range, range->adjustment->value);
(* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
}
range = GTK_RANGE (widget);
- gtk_range_calc_layout (range);
+ gtk_range_calc_layout (range, range->adjustment->value);
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
range = GTK_RANGE (widget);
- gtk_range_calc_layout (range);
+ gtk_range_calc_layout (range, range->adjustment->value);
sensitive = GTK_WIDGET_IS_SENSITIVE (widget);
event->button == 2) ||
range->layout->mouse_location == MOUSE_SLIDER)
{
+ gboolean need_value_update = FALSE;
+
/* Any button can be used to drag the slider, but you can start
* dragging the slider with a trough click using button 2;
* On button 2 press, we warp the slider to mouse position,
*/
if (event->button == 2)
{
- gdouble slider_low_value, slider_high_value;
+ gdouble slider_low_value, slider_high_value, new_value;
slider_high_value =
coord_to_value (range,
event->y - range->layout->slider.height :
event->x - range->layout->slider.width);
- /* middle button jumps to point */
- gtk_range_internal_set_value (range,
- slider_low_value + (slider_high_value - slider_low_value) / 2);
+ /* compute new value for warped slider */
+ new_value = slider_low_value + (slider_high_value - slider_low_value) / 2;
- /* Calc layout so we can set slide_initial_slider_position
+ /* recalc slider, so we can set slide_initial_slider_position
* properly
*/
- gtk_range_calc_layout (range);
+ range->need_recalc = TRUE;
+ gtk_range_calc_layout (range, new_value);
+
+ /* defer adjustment updates to update_slider_position() in order
+ * to keep pixel quantisation
+ */
+ need_value_update = TRUE;
}
if (range->orientation == GTK_ORIENTATION_VERTICAL)
range->slide_initial_coordinate = event->x;
}
+ if (need_value_update)
+ update_slider_position (range, event->x, event->y);
+
range_grab_add (range, MOUSE_SLIDER, event->button);
return TRUE;
gtk_widget_queue_draw (widget);
if (range->layout->grab_location == MOUSE_SLIDER)
- update_slider_position (range, event->x, event->y);
+ update_slider_position (range, x, y);
/* We handled the event if the mouse was in the range_rect */
return range->layout->mouse_location != MOUSE_OUTSIDE;
}
static void
-gtk_range_calc_layout (GtkRange *range)
+gtk_range_calc_layout (GtkRange *range,
+ gdouble adjustment_value)
{
gint slider_width, stepper_size, trough_border, stepper_spacing;
gint slider_length;
y = top;
- y += (bottom - top - height) * ((range->adjustment->value - range->adjustment->lower) /
+ y += (bottom - top - height) * ((adjustment_value - range->adjustment->lower) /
(range->adjustment->upper - range->adjustment->lower - range->adjustment->page_size));
y = CLAMP (y, top, bottom);
x = left;
- x += (right - left - width) * ((range->adjustment->value - range->adjustment->lower) /
+ x += (right - left - width) * ((adjustment_value - range->adjustment->lower) /
(range->adjustment->upper - range->adjustment->lower - range->adjustment->page_size));
x = CLAMP (x, left, right);
{
GtkRange *range;
+ GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
-
gtk_range_scroll (range, range->timer->step);
+ GDK_THREADS_LEAVE ();
return TRUE;
}
{
GtkRange *range;
+ GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
-
range->timer->timeout_id =
g_timeout_add (SCROLL_LATER_DELAY,
second_timeout,
range);
+ GDK_THREADS_LEAVE ();
/* remove self */
return FALSE;
{
GtkRange *range;
+ GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
-
gtk_range_update_value (range);
-
range->update_timeout_id = 0;
+ GDK_THREADS_LEAVE ();
/* self-remove */
return FALSE;
points[4] = points[0];
gdk_draw_polygon (window, style->black_gc, FALSE, points, 4);
- gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
+ gdk_gc_set_line_attributes (style->black_gc, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
if (area)
gdk_gc_set_clip_rectangle (style->black_gc, NULL);